\(\int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx\) [696]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 12 \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=-\frac {\cos (x)}{b+3 \sin (x)} \]

[Out]

-cos(x)/(b+a*sin(x))

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {2833, 8} \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=-\frac {\cos (x)}{a \sin (x)+b} \]

[In]

Int[(a + b*Sin[x])/(b + a*Sin[x])^2,x]

[Out]

-(Cos[x]/(b + a*Sin[x]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2833

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-(
b*c - a*d))*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 - b^2))), x] + Dist[1/((m + 1)*(a^2 - b
^2)), Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[(a*c - b*d)*(m + 1) - (b*c - a*d)*(m + 2)*Sin[e + f*x], x], x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && LtQ[m, -1] && IntegerQ[2*m]

Rubi steps \begin{align*} \text {integral}& = -\frac {\cos (x)}{b+a \sin (x)}+\frac {\int 0 \, dx}{a^2-b^2} \\ & = -\frac {\cos (x)}{b+a \sin (x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=-\frac {\cos (x)}{b+3 \sin (x)} \]

[In]

Integrate[(3 + b*Sin[x])/(b + 3*Sin[x])^2,x]

[Out]

-(Cos[x]/(b + 3*Sin[x]))

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(25\) vs. \(2(12)=24\).

Time = 0.74 (sec) , antiderivative size = 26, normalized size of antiderivative = 2.17

method result size
parallelrisch \(\frac {-a \sin \left (x \right )-b \left (\cos \left (x \right )+1\right )}{b \left (b +a \sin \left (x \right )\right )}\) \(26\)
default \(\frac {-\frac {a \tan \left (\frac {x}{2}\right )}{b}-1}{\frac {\left (\tan ^{2}\left (\frac {x}{2}\right )\right ) b}{2}+a \tan \left (\frac {x}{2}\right )+\frac {b}{2}}\) \(36\)
risch \(-\frac {2 \left (i a +b \,{\mathrm e}^{i x}\right )}{a \left (a \,{\mathrm e}^{2 i x}-a +2 i b \,{\mathrm e}^{i x}\right )}\) \(40\)
norman \(\frac {-2 \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-\frac {2 a \tan \left (\frac {x}{2}\right )}{b}-\frac {2 a \left (\tan ^{3}\left (\frac {x}{2}\right )\right )}{b}-2}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right ) \left (\left (\tan ^{2}\left (\frac {x}{2}\right )\right ) b +2 a \tan \left (\frac {x}{2}\right )+b \right )}\) \(63\)

[In]

int((a+b*sin(x))/(b+a*sin(x))^2,x,method=_RETURNVERBOSE)

[Out]

(-a*sin(x)-b*(cos(x)+1))/b/(b+a*sin(x))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=-\frac {\cos \left (x\right )}{a \sin \left (x\right ) + b} \]

[In]

integrate((a+b*sin(x))/(b+a*sin(x))^2,x, algorithm="fricas")

[Out]

-cos(x)/(a*sin(x) + b)

Sympy [F(-1)]

Timed out. \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=\text {Timed out} \]

[In]

integrate((a+b*sin(x))/(b+a*sin(x))**2,x)

[Out]

Timed out

Maxima [F(-2)]

Exception generated. \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((a+b*sin(x))/(b+a*sin(x))^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?`
 for more de

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 32 vs. \(2 (12) = 24\).

Time = 0.29 (sec) , antiderivative size = 32, normalized size of antiderivative = 2.67 \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=-\frac {2 \, {\left (a \tan \left (\frac {1}{2} \, x\right ) + b\right )}}{{\left (b \tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, a \tan \left (\frac {1}{2} \, x\right ) + b\right )} b} \]

[In]

integrate((a+b*sin(x))/(b+a*sin(x))^2,x, algorithm="giac")

[Out]

-2*(a*tan(1/2*x) + b)/((b*tan(1/2*x)^2 + 2*a*tan(1/2*x) + b)*b)

Mupad [B] (verification not implemented)

Time = 7.44 (sec) , antiderivative size = 24, normalized size of antiderivative = 2.00 \[ \int \frac {3+b \sin (x)}{(b+3 \sin (x))^2} \, dx=-\frac {a\,\sin \left (x\right )+b\,\left (\cos \left (x\right )+1\right )}{b\,\left (b+a\,\sin \left (x\right )\right )} \]

[In]

int((a + b*sin(x))/(b + a*sin(x))^2,x)

[Out]

-(a*sin(x) + b*(cos(x) + 1))/(b*(b + a*sin(x)))